package com.eascs.workflow.exception.dao;

import java.util.Date;

import org.springframework.stereotype.Repository;

import com.eascs.app.log.Logger;
import com.eascs.app.log.LoggerFactory;
import com.eascs.workflow.common.dao.BaseLogDao;
import com.eascs.workflow.common.entity.exception.JSErrorEntity;

@Repository
public class CatchJSExceptionDao extends BaseLogDao {
	private Logger logger = LoggerFactory.getLogger(this.getClass());

	public int insert(JSErrorEntity jsErrorEntity) {
		try {
			if (jsErrorEntity.getCreateTime() == null) {
				jsErrorEntity.setCreateTime(new Date());
			}
			return super.logJdbcSession.insert(jsErrorEntity);
		} catch (Exception e) {
			logger.error("js异常捕获失败,e:", e);
			return 0;
		}
	}
}
